package com.learning.spring.cloud.alibaba.ribbon.loadbalanced;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Repository;
import org.springframework.web.client.RestTemplate;

/**
 * ClassName: RibbonLoadBalancedApplication
 * Description: Ribbon 用户端负载均衡
 * Date: 2021/7/25 23:03 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Slf4j
@MapperScan(value = "com.learning.spring.cloud.alibaba.ribbon.loadbalanced", annotationClass = Repository.class)
@SpringBootApplication
public class RibbonLoadBalancedApplication {

    public static void main(String[] args) {
        SpringApplication.run(RibbonLoadBalancedApplication.class, args);
        log.info("~~~~~~~~~ ribbon LoadBalance application is started ~~~~~~~~~");
    }

    @Bean
    public RestTemplate restTemplate(RestTemplateBuilder builder) {
        return builder.build();
    }
}
